﻿using Common;
using Domain.IRepositories;
using Domain.Model;
using Infrastructure.Interface;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace Domain.Repository.Repositories
{
    /// <summary>
    /// 用户仓储实现
    /// <remarks></remarks>
    /// </summary>
    public class UserRepository : RepositoryBase<User>, IUserRepository
    {
        /// <summary>
        /// 用户仓储实现
        /// </summary>
        /// <param name="context">仓储上下文</param>
        public UserRepository(IRepositoryContext context)
            : base(context)
        {
        }

        public User Login(string userName, string password, out string message)
        {
            throw new NotImplementedException();
        }

        public User Login1(string userName, string password, out string message)
        {
            throw new NotImplementedException();
        }
        public int OutExcle()
        {
            ExcelHelper eh = new ExcelHelper();
            DataTable dt = new DataTable();
            dt = this.Context.Database.SqlQuery(@"SELECT 
      [合同编号]
      ,[申请日期]
      ,[姓名]
      ,[身份证号]
      ,[户籍地址]
      ,[手机]
      ,[现居住地址]
      ,[产品]
      ,[分期数]
      ,[贷款本金]
      ,[单位_学校_个体全称]
      ,[单位电话]
      ,[销售顾问姓名]
      ,[单位地址]
      ,[销售点名称]
      ,[销售点地址]
      ,[配偶姓名]
      ,[配偶移动电话]
      ,[家庭成员名称]
      ,[家庭成员类型]
      ,[家庭成员电话]
      ,[联系人姓名]
      ,[联系电话]
      ,[客户银行卡号]
      ,[客户开户银行]
      ,[客户银行账户名]
  FROM[longlong].[dbo].[Users]", null);
            eh.DtToExcel(dt, "");
            return 1;
        }
    }
}
